<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <link href="/static/layui/css/layui.css" rel="stylesheet" type="text/css">
</head>
<div style="padding:10px 50px 10px 10px">
    <form id="procDefForm" method="post" action="/pc/biz/procDef/edit" class="layui-form">
        <div style="margin-bottom:20px;font-size:14px;border-bottom:1px solid #ccc; padding-bottom: 5px;">流程信息</div>
        <div class="layui-form-item">
            <label class="layui-form-label">流程名称</label>
            <div class="layui-input-block">
                <input class="layui-input" name="name" lay-verify="required" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">流程键</label>
            <div class="layui-input-block">
                <input class="layui-input" name="key" lay-verify="required" />
            </div>
        </div>
        <div class="layui-form-item" id="uploader">
            <label class="layui-form-label">流程zip</label>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button id="submitButton" class="layui-btn" lay-submit lay-filter="*">保存</button>
                <button type="button" class="layui-btn layui-btn-primary" onclick="closeAll()">取消</button>
            </div>
        </div>
    </form>
</div>
<script src="/static/jquery/jquery.min.js"></script>
<script src="/static/layui/layui.js"></script>
<script src="/static/jqgrid/jquery.jqGrid.minffe4.js?0820"></script>
<script src="/static/jqgrid/myjqGrid.js?v=1.0.1"></script>
@@ include("../../upload.jsp"){} $$
<script type="text/javascript">
    layui.use('form', function(){
        var form = layui.form;
        form.on('submit(*)', function(data){
            var form = $("#procDefForm");
            var formData = form.serialize();
            $.post(form.attr("action"), formData, function(data){
                if(data.status == 200){
                    layer.alert(data.msg, {
                        icon: 1,
                        skin: 'layer-ext-moon'
                    },function () {
                        parent.myJqGrid.reloadGrid({});
                        parent.layer.closeAll();
                    });
                }else{
                    layer.alert(data.msg, {
                        icon: 2,
                        skin: 'layer-ext-moon'
                    });
                }
            });
            return false; //阻止表单跳转。
        });
    });
    function closeAll() {
        parent.layer.closeAll();
    }
    $(function () {

        $('#uploader').myFileUpload({
            type: 'file',
            ctxPath: "${ctxPath!}",
            reqUrl: '${ctxPath!}/file/upload',
            hiddenInputName: 'zip',
            urlPrefix: '/upload/ueditor/file/',
            urlPreviewPrefix: '${ctxPath!}/upload/ueditor/file/'
        });
    });
</script>